

ac.game:event '单位-添加技能'(function(_,hero,skill)
    if skill['学习分类']=='伤害' then
        local attack = ('%s输出'):format(skill.attack_type)
        local damage = ('%s伤害'):format(skill.damage_type)
        local speed = ('%s速度'):format(skill.speed_type)
        hero:set_data('优势速度',speed)
        hero:set_data('优势伤害',damage)
        hero:set_data('优势输出',attack)
        skill:gc(hero:add_buff('普攻伤害'){class=skill.damage_type,level = 1})
        skill:gc(hero:add_buff('普攻输出'){class=skill.attack_type,level = 1})

    end
end)



local info = {
    {'力量','通用',[[UI\Widgets\Console\Human\infocard-heroattributes-str.blp]]},
    {'敏捷','物理',[[UI\Widgets\Console\Human\infocard-heroattributes-agi.blp]]},
    {'智力','魔法',[[UI\Widgets\Console\Human\infocard-heroattributes-int.blp]]},
}
local attacks = {'普攻','技能','适应'}

ac.game:event '玩家-选择主属性'(function(_,player,item)
    local hero = player.hero
    local list = {}
    for _,temp in ipairs(info) do
        local damage_type = temp[2]
        local attack_type = table.random(attacks)
        local tip = ('|cff999999伤害类型：|r%s|n|cff999999输出类型：|r%s'):format(damage_type,attack_type)
        table.insert(list,{
            name = '选择主属性',
            art = temp[3],
            speed_type = speed_type,
            attack_type = attack_type,
            damage_type = damage_type,
            tags = temp[1],
            tip = tip,
            ui_tip = '学习会自动替换英雄的的|cff00ffff伤害类型|r和|cffff00ff输出类型|r',
        })
    end
    
    player:notify('玩家-选择技能面板',player,list,function(temp,index)
        local attack = ('%s输出'):format(temp.attack_type)
        local damage = ('%s伤害'):format(temp.damage_type)
        local speed = ('%s速度'):format(temp.speed_type)
        hero:set_data('优势速度',speed)
        hero:set_data('优势伤害',damage)
        hero:set_data('优势输出',attack)
        hero:add_buff('普攻伤害'){class=temp.damage_type,level = 1}
        hero:add_buff('普攻输出'){class=temp.attack_type,level = 1}
        player:notify('玩家-选择专属词条',player,item,1)
    end)
end)
